package com.jeespring.pay.controller;

import com.jeespring.dto.String;
import com.jeespring.pay.service.PayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/pay")
public class PayController {

    @Autowired
    private PayService payService;

    @Value("${server.port}")
    private int port;

    @GetMapping("/{id}")
    public String pay(@PathVariable Long id){
        String<Object> String = new String<>();
        String result = payService.pay(id);
        String.setData(result);
        String.setMsg("请求成功，请求端口号：" + port);
        return String;
    }

    @GetMapping("/timeout/{id}")
    public String payTimeout(@PathVariable Long id){
        String<Object> String = new String<>();
        String result = payService.payTimeout(id);
        String.setData(result);
        String.setMsg("请求成功，请求端口号：" + port);
        return String;
    }
}
